<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script>
  function saveReg(){
    var url=timestamp('${ctx}/physical/savePhyUserInfo');
    var hrefUrl = timestamp('${ctx}/physical/physicalIndex');
    hrefUrl=timestamp(hrefUrl);
    if (flag) {
      flag = false;
      formSubmitInput("inputForm");
      $("#inputForm input,#inputForm select").removeAttr("disabled");
      $("#inputForm").ajaxSubmit({
        type: 'post', // 提交方式 get/post
        url:url, // 需要提交的 url
        success: function(data) { // data 保存提交后返回的数据，一般为 json 数据
          if (data.code == "success") {
            parent.toastr.success(data.data);
            parent.loadDiv("mainCenterDiv", hrefUrl);
            parent.layer.closeAll();
          } else if(data.code == 'info'){
            parent.toastr.success(data.data);
            parent.loadDiv("mainCenterDiv", hrefUrl);
            parent.layer.closeAll();
          } else {
            flag = true;
            toastr.error(data.data);
          }
        }
      });
    }
    return false;
  }
</script>


<div class="panel-body">
    <div class="col-lg-12">
      <form id="inputForm" class="form-horizontal" data-parsley-validate="">
        <input type="hidden" id="patientId" name="id">
        <input type="hidden" id="cardPayFlag" name="cardPayFlag">
        <input type="hidden" id="cardNo" name="cardNo">
        <div class="form-group">
          <label class="col-sm-3 control-label">姓名：</label>

          <div class="col-sm-9">
            <input name="name" id="name" class="form-control"
                   data-parsley-required="true" maxlength="100"/>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">性别：</label>

          <div class="col-sm-9">
            <select name="sex" class="form-control" id="sexID" data-parsley-required="true">
              <c:forEach items="${fns:getDictList('SEX_DICT')}" var="sex">
                <option value="${sex.value}">${sex.label}</option>
              </c:forEach>
            </select>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">年龄：</label>

          <div class="col-sm-9">
            <input type="text" id="age" name="age" class="form-control" max="100" min="0"
                   data-parsley-required="true"/>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">诊别：</label>

          <div class="col-sm-9">
            <select name="firstVisitIndicator" class="form-control" id="visitIndicator">
              <c:forEach items="${fns:getDictList('first_visit_indicator')}"
                         var="firstVisit">
                <option value="${firstVisit.value}">${firstVisit.label}</option>
              </c:forEach>
            </select>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">费别：</label>

          <div class="col-sm-9">
            <%-- <input name="chargeType" class="form-control"  maxlength="100" />--%>
            <select name="chargeType" class="form-control" id="chargeType">
              <c:forEach items="${fns:getDictList('CHARGE_TYPE_DICT')}"
                         var="chargeType">
                <c:choose>
                  <c:when test="${chargeType.value}">
                    <option value="${chargeType.value}" selected="selected">${chargeType.label}</option>
                  </c:when>
                  <c:otherwise>
                    <option value="${chargeType.value}">${chargeType.label}</option>
                  </c:otherwise>
                </c:choose>

              </c:forEach>
            </select>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">身份：</label>

          <div class="col-sm-9">
            <select name="identity" class="form-control" id="identity">
              <c:forEach items="${fns:getDictList('PROFESSION_DICT')}"
                         var="profession">
                <option value="${profession.value}">${profession.label}</option>
              </c:forEach>
            </select>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">身份证号：</label>

          <div class="col-sm-9">
            <input name="idNo" id="idNo" class="form-control"
                   data-parsley-checkidcard="3" maxlength="100"/>
          </div>
        </div>
        <%--<div class="form-group">--%>
          <%--<label class="col-sm-3 control-label">合同单位：</label>--%>

          <%--<div class="col-sm-9">--%>
            <%--<input name="unitInContract" id="unitInContract" class="form-control" maxlength="100"/>--%>
          <%--</div>--%>
        <%--</div>--%>
      </form>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-30">
          <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"
                 onclick="saveReg();">&nbsp;
        </div>
      </div>
    </div>
  </div>
